<?php

class Group_Form_Create extends Zend_Form
{
	public function init()
	{
		parent::init();

        // Set the method for the display form to POST
		$this
			->setAction('')
			->setMethod('post')
		;

		$stripSlashesFilter = new Euso_Filter_StripSlashes();

		// Create and configure idname element
		$idname = new Zend_Form_Element_Text('idname');
		$idname
			->setLabel('Group name:')
			->setRequired(true)
			->addFilter($stripSlashesFilter)
			->addFilter('StringTrim')
			->addValidator('stringLength', false, array(4, 50))
			->setAttrib('size', 36)
			->setAttrib('maxLength', 50)
		;
		$this->addElement($idname);

		// Create and configure brief element
		$tagline = new Zend_Form_Element_Text('tagline');
		$tagline
			->setLabel('Tagline:')
			->addFilter($stripSlashesFilter)
			->addFilter('StringTrim')
			->addValidator('stringLength', false, array(0, 250))
			->setAttrib('size', 36)
			->setAttrib('maxLength', 120)
		;
		$this->addElement($tagline);

		$about = new Zend_Form_Element_TextArea('profile_about');
		$about
			->setLabel('About:')
			->addFilter($stripSlashesFilter)
			->addFilter('StringTrim')
			->setAttrib('rows', 4)
			->setAttrib('cols', 64)
			->setAttrib('escape', false)
		;
		$this->addElement($about);

		//TODO: about, tags

        // Add the submit button
		$submit = new Zend_Form_Element_Submit('submit');
		$submit
			->setLabel('Create group')
			->setIgnore(true)
			->setAttrib('class', 'submit')
		;
		$this->addElement($submit);
	}
}
